import pandas as pd
import sqlite3
import tkinter
from tkinter import ttk
data = pd.read_csv('ToolType.csv',sep=',')

root = tkinter.Tk()
root.title('SQLITE control')
root.geometry('1800x850')

S = tkinter.Scrollbar(root,orient=tkinter.HORIZONTAL)
S2 = tkinter.Scrollbar(root,orient=tkinter.VERTICAL)

S.pack(side=tkinter.BOTTOM,fill=tkinter.X)
S2.pack(side=tkinter.RIGHT,fill=tkinter.Y)

form = ttk.Treeview(root,height=40,xscrollcommand=S.set,yscrollcommand=S2.set)  #创建表格对象

form['columns'] = tuple(data.columns)

for i in data.columns:
    form.column(i, width=200, anchor='center')
    form.heading(i,text=i)
d = data.shape
for i in range(d[0]):
    form.insert("",i, text=i,values=tuple(data.iloc[i]))
    #form.insert("", 0, text='1', values=("1", "djy", "18"))

S.config(command=form.xview)
S2.config(command=form.yview)

#print(df.shape)  查看所有的数据。有几行有列表
#print(df.dtypes)  查看数据类型  object
#print(tuple(df.iloc[:3]))  看某行的数据
#print(tuple(df.columns))   查看头部的名称

form.pack()
root.mainloop()